
import { useSearchParams,useLocation } from "react-router-dom";

export default function(){

    const [search,setSearch] = useSearchParams()
    const a = search.get('a')
    const b = search.get('b')

    const state = useLocation()
    console.log(state)
    return (
        <div>
        <h3>获取Url参数</h3>
        a:{a}<br/>
        b:{b}<br/>
        x:{state.state.x}<br/>
        y:{state.state.y}<br/>
        </div>
    )
}